/*******
 * @file camera.hpp
 * @auther: hao wang
 * @name: Camera
 * @brief: the wrapper class for JHcap2 camera
TODO:
   framerate setting
   continueous or not setting
   frame size
   exposure setting
*/

#ifndef CAMERA_H
#define CAMERA_H

#include <JHCap2/JHCap.h>
#include <opencv2/core.hpp>
#include <opencv2/opencv.hpp>


class Camera {
    public:
    Camera();
    ~Camera();

    /// \brief accepting a reference of Mat object, write the video output into it
    /// \param src object to be write
    bool getImage(cv::Mat &src);

    /// \brief change the frame rate
    /// \param frame_per_second new frame rate
    /// \todo not defined yet
    bool setFrameRate(int frame_per_second);

    /// \brief set exposure
    bool getImage(cv::Mat &src, int exposure) {
        CameraSetExposure(device_id, exposure);
        getImage(src);
        CameraSetExposure(device_id, this->exposure);
    }

    private:
    int exposure = 500;
    const static int GAIN = 100;
    const static int device_id = 0;
    int width;
    int height;
    int len;
};

#endif